import ctypes

class ClamAVScanner(object):
    "Use clamav virus scan engine"
    
    #load ClamAV DLL
    clamdll = ctypes.cdll.LoadLibrary('clamloader.dll')
    clamdll.engine_ver.restype = ctypes.c_char_p
    clamdll.scan_file.restype = ctypes.c_char_p

    print "ClamAV engine version: %s" % clamdll.engine_ver();
        
    def load_signature(self, file_list):
        for file_name in file_list:
            ClamAVScanner.clamdll.load_signature(file_name)
            
        self.clamdll.compile_engine()

    def scan_file(self, file_name):
        return ClamAVScanner.clamdll.scan_file(file_name)

